package com.ssy.lingxi.system.entity;

import com.ssy.lingxi.system.handler.converter.JpaJsonToMapConverter;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Map;

/**
 * 菜单权限表
 */
@Entity
@Table(schema = "public", name = "cf_menu")
@ApiModel(value = "菜单权限")
public class Menu implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * 菜单ID
     */
    @Id
    @GeneratedValue(strategy= GenerationType.SEQUENCE,generator="menu_seq")
    @SequenceGenerator(sequenceName="cf_menu_seq", name="menu_seq",allocationSize = 1)
    @ApiModelProperty(value = "主键ID")
    private Long id;

    /**
     * 菜单名称
     */
    @Column(name  = "title")
    @ApiModelProperty(value = "菜单名称")
    private String title;

    /**
     * 菜单编码
     */
    @Column(name  = "code")
    @ApiModelProperty(value = "菜单编码")
    private String code;

    /**
     * 菜单权限标识
     */
    @Column(name  = "permission")
    @ApiModelProperty(value = "菜单权限标识")
    private Integer permission;


    /**
     * URL
     */
    @Column(name  = "URL")
    @ApiModelProperty(value = "URL")
    private String url;

    /**
     * 父菜单ID
     */
    @Column(name  = "parentId")
    @ApiModelProperty(value = "父菜单ID")
    private Long parentId;

    /**
     * 菜单描述
     */
    @Column(name  = "describe")
    @ApiModelProperty(value = "菜单描述")
    private String  describe;
    /**
     * 排序值
     */
    @Column(name  = "sort")
    @ApiModelProperty(value = "排序值")
    private Integer sort;

    /**
     * 前端显示时，是否上移一层
     */
    @Column
    @ApiModelProperty(value = "是否上移一层")
    private Integer up;

    /**
     * 菜单类型（1=菜单,2=按钮）
     */
    @Column(name  = "type")
    @ApiModelProperty(value = "权限菜单类型：1=菜单,2=按钮")
    private Integer type;

    /**
     * 状态(1=正常，0=删除)
     */
    @Column(name  = "state")
    @ApiModelProperty(value = "状态(1=正常，0=删除)")
    private Integer state;

    /**
     * 创建人
     */
    @Column(name  = "create_role")
    @ApiModelProperty(value = "创建人")
    private Long createRoleId;

    /**
     * 创建时间
     */
    @Column(name  = "create_time")
    @ApiModelProperty(value = "创建时间")
    private Long createTime;

    /**
     * 更新时间
     */
    @Column(name  = "update_time")
    @ApiModelProperty(value = "更新时间")
    private Long updateTime;

    /**
     * 适用的平台客户端：1-能力中心，2-App，99-平台后台
     */
    @Column
    @ApiModelProperty(value = "适用的平台客户端")
    private Integer source;

    /**
     * 是否可配置数据权限，0-否，1-是
     */
    @Column
    @ApiModelProperty(value = "是否可配置数据权限")
    private Integer dataAuthConfig;

    /**
     * 菜单属性
     */
    @Convert(converter = JpaJsonToMapConverter.class)
    @Column(columnDefinition = "jsonb")
    private Map<String, Object> attrs;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public Integer getPermission() {
        return permission;
    }

    public void setPermission(Integer permission) {
        this.permission = permission;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public Long getParentId() {
        return parentId;
    }

    public void setParentId(Long parentId) {
        this.parentId = parentId;
    }

    public String getDescribe() {
        return describe;
    }

    public void setDescribe(String describe) {
        this.describe = describe;
    }

    public Integer getSort() {
        return sort;
    }

    public void setSort(Integer sort) {
        this.sort = sort;
    }

    public Integer getUp() {
        return up;
    }

    public void setUp(Integer up) {
        this.up = up;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getState() {
        return state;
    }

    public void setState(Integer state) {
        this.state = state;
    }

    public Long getCreateRoleId() {
        return createRoleId;
    }

    public void setCreateRoleId(Long createRoleId) {
        this.createRoleId = createRoleId;
    }

    public Long getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Long createTime) {
        this.createTime = createTime;
    }

    public Long getUpdateTime() {
        return updateTime;
    }

    public void setUpdateTime(Long updateTime) {
        this.updateTime = updateTime;
    }

    public Integer getSource() {
        return source;
    }

    public void setSource(Integer source) {
        this.source = source;
    }

    public Map<String, Object> getAttrs() {
        return attrs;
    }

    public void setAttrs(Map<String, Object> attrs) {
        this.attrs = attrs;
    }

    public Integer getDataAuthConfig() {
        return dataAuthConfig;
    }

    public void setDataAuthConfig(Integer dataAuthConfig) {
        this.dataAuthConfig = dataAuthConfig;
    }
}
